﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UtilZ.Dotnet.Ex.Base;
using UtilZ.Dotnet.Ex.Log;

namespace ConAppCore
{
    internal class TestStringEx
    {
        public static void Test()
        {
            try
            {
                string hexStr1 = " 0xaa 0x12 0x34 0xbc ";
                string hexStr2 = "aa 12 34 bc";
                string hexStr3 = " 0xaa0x120x340xbc ";
                string hexStr4 = "aa1234bc";

                byte[] buffer1 = ConvertEx.HexadecimaStringToBytes(hexStr1);
                byte[] buffer2 = ConvertEx.HexadecimaStringToBytes(hexStr2);
                byte[] buffer3 = ConvertEx.HexadecimaStringToBytes(hexStr3);
                byte[] buffer4 = ConvertEx.HexadecimaStringToBytes(hexStr4);

                byte[] buffer21 = ConvertEx.HexadecimaStringToBytes(hexStr1.AsMemory());
                byte[] buffer22 = ConvertEx.HexadecimaStringToBytes(hexStr2.AsMemory());
                byte[] buffer23 = ConvertEx.HexadecimaStringToBytes(hexStr3.AsMemory());
                byte[] buffer24 = ConvertEx.HexadecimaStringToBytes(hexStr4.AsMemory());
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }

    }
}
